<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActiveRecord::ConnectionAdapters::AbstractAdapter</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActiveRecord::ConnectionAdapters::AbstractAdapter</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter_rb.html">
                vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
All the concrete database adapters follow the interface laid down in this
class. You can use this interface directly by borrowing the database
connection from the <a href="../Base.html">Base</a> with <a
href="../Base.html#M001463">Base.connection</a>.
</p>
<p>
Most of the methods in the adapter are useful during migrations. Most
notably, <a
href="SchemaStatements.html#M001150">SchemaStatements#create_table</a>, <a
href="SchemaStatements.html#M001152">SchemaStatements#drop_table</a>, <a
href="SchemaStatements.html#M001158">SchemaStatements#add_index</a>, <a
href="SchemaStatements.html#M001159">SchemaStatements#remove_index</a>, <a
href="SchemaStatements.html#M001153">SchemaStatements#add_column</a>, <a
href="SchemaStatements.html#M001155">SchemaStatements#change_column</a> and
<a href="SchemaStatements.html#M001154">SchemaStatements#remove_column</a>
are very useful.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M001288">active?</a>&nbsp;&nbsp;
      <a href="#M001282">adapter_name</a>&nbsp;&nbsp;
      <a href="#M001287">disable_referential_integrity</a>&nbsp;&nbsp;
      <a href="#M001290">disconnect!</a>&nbsp;&nbsp;
      <a href="#M001296">format_log_entry</a>&nbsp;&nbsp;
      <a href="#M001295">log</a>&nbsp;&nbsp;
      <a href="#M001294">log_info</a>&nbsp;&nbsp;
      <a href="#M001285">prefetch_primary_key?</a>&nbsp;&nbsp;
      <a href="#M001286">quote_table_name</a>&nbsp;&nbsp;
      <a href="#M001293">raw_connection</a>&nbsp;&nbsp;
      <a href="#M001289">reconnect!</a>&nbsp;&nbsp;
      <a href="#M001291">requires_reloading?</a>&nbsp;&nbsp;
      <a href="#M001284">supports_count_distinct?</a>&nbsp;&nbsp;
      <a href="#M001283">supports_migrations?</a>&nbsp;&nbsp;
      <a href="#M001292">verify!</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name"><a href="Quoting.html">Quoting</a></span>
        <span class="include-name"><a href="DatabaseStatements.html">DatabaseStatements</a></span>
        <span class="include-name"><a href="SchemaStatements.html">SchemaStatements</a></span>
        <span class="include-name"><a href="QueryCache.html">QueryCache</a></span>
      </div>
    </div>

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M001288" class="method-detail">
        <a name="M001288"></a>

        <div class="method-heading">
          <a href="#M001288" class="method-signature">
          <span class="method-name">active?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Is this connection active and ready to perform queries?
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001288-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001288-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 83</span>
83:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">active?</span>
84:         <span class="ruby-ivar">@active</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">false</span>
85:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001282" class="method-detail">
        <a name="M001282"></a>

        <div class="method-heading">
          <a href="#M001282" class="method-signature">
          <span class="method-name">adapter_name</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the human-readable name of the adapter. Use mixed case - one can
always use downcase if needed.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001282-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001282-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 37</span>
37:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">adapter_name</span>
38:         <span class="ruby-value str">'Abstract'</span>
39:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001287" class="method-detail">
        <a name="M001287"></a>

        <div class="method-heading">
          <a href="#M001287" class="method-signature">
          <span class="method-name">disable_referential_integrity</span><span class="method-args">() {|| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Override to turn off referential integrity while executing +&amp;block+
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001287-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001287-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 76</span>
76:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">disable_referential_integrity</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
77:         <span class="ruby-keyword kw">yield</span>
78:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001290" class="method-detail">
        <a name="M001290"></a>

        <div class="method-heading">
          <a href="#M001290" class="method-signature">
          <span class="method-name">disconnect!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Close this connection
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001290-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001290-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 93</span>
93:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">disconnect!</span>
94:         <span class="ruby-ivar">@active</span> = <span class="ruby-keyword kw">false</span>
95:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001294" class="method-detail">
        <a name="M001294"></a>

        <div class="method-heading">
          <a href="#M001294" class="method-signature">
          <span class="method-name">log_info</span><span class="method-args">(sql, name, runtime)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001294-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001294-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 120</span>
120:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_info</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">runtime</span>)
121:         <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@logger</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">debug?</span>
122:           <span class="ruby-identifier">name</span> = <span class="ruby-node">&quot;#{name.nil? ? &quot;SQL&quot; : name} (#{sprintf(&quot;%f&quot;, runtime)})&quot;</span>
123:           <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">debug</span> <span class="ruby-identifier">format_log_entry</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">sql</span>.<span class="ruby-identifier">squeeze</span>(<span class="ruby-value str">' '</span>))
124:         <span class="ruby-keyword kw">end</span>
125:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001285" class="method-detail">
        <a name="M001285"></a>

        <div class="method-heading">
          <a href="#M001285" class="method-signature">
          <span class="method-name">prefetch_primary_key?</span><span class="method-args">(table_name = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Should primary key values be selected from their corresponding sequence
before the insert statement? If true, next_sequence_value is called before
each insert to set the record&#8216;s primary key. This is false for all
adapters but Firebird.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001285-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001285-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 57</span>
57:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prefetch_primary_key?</span>(<span class="ruby-identifier">table_name</span> = <span class="ruby-keyword kw">nil</span>)
58:         <span class="ruby-keyword kw">false</span>
59:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001286" class="method-detail">
        <a name="M001286"></a>

        <div class="method-heading">
          <a href="#M001286" class="method-signature">
          <span class="method-name">quote_table_name</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Override to return the quoted table name if the database needs it
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001286-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001286-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 69</span>
69:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quote_table_name</span>(<span class="ruby-identifier">name</span>)
70:         <span class="ruby-identifier">name</span>
71:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001293" class="method-detail">
        <a name="M001293"></a>

        <div class="method-heading">
          <a href="#M001293" class="method-signature">
          <span class="method-name">raw_connection</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Provides access to the underlying database connection. Useful for when you
need to call a proprietary method such as postgresql&#8216;s lo_* methods
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001293-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001293-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 116</span>
116:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">raw_connection</span>
117:         <span class="ruby-ivar">@connection</span>
118:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001289" class="method-detail">
        <a name="M001289"></a>

        <div class="method-heading">
          <a href="#M001289" class="method-signature">
          <span class="method-name">reconnect!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Close this connection and open a new one in its place.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001289-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001289-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 88</span>
88:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reconnect!</span>
89:         <span class="ruby-ivar">@active</span> = <span class="ruby-keyword kw">true</span>
90:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001291" class="method-detail">
        <a name="M001291"></a>

        <div class="method-heading">
          <a href="#M001291" class="method-signature">
          <span class="method-name">requires_reloading?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns true if its safe to reload the connection between requests for
development mode. This is not the case for Ruby/MySQL and it&#8216;s not
necessary for any adapters except SQLite.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001291-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001291-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 99</span>
 99:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">requires_reloading?</span>
100:         <span class="ruby-keyword kw">false</span>
101:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001284" class="method-detail">
        <a name="M001284"></a>

        <div class="method-heading">
          <a href="#M001284" class="method-signature">
          <span class="method-name">supports_count_distinct?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Does this adapter support using DISTINCT within COUNT? This is
<tt>true</tt> for all adapters except sqlite.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001284-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001284-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 49</span>
49:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">supports_count_distinct?</span>
50:         <span class="ruby-keyword kw">true</span>
51:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001283" class="method-detail">
        <a name="M001283"></a>

        <div class="method-heading">
          <a href="#M001283" class="method-signature">
          <span class="method-name">supports_migrations?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Does this adapter support migrations? Backend specific, as the abstract
adapter always returns <tt>false</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001283-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001283-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 43</span>
43:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">supports_migrations?</span>
44:         <span class="ruby-keyword kw">false</span>
45:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001292" class="method-detail">
        <a name="M001292"></a>

        <div class="method-heading">
          <a href="#M001292" class="method-signature">
          <span class="method-name">verify!</span><span class="method-args">(timeout)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Lazily verify this connection, calling +<a
href="AbstractAdapter.html#M001288">active?</a>+ only if it hasn&#8216;t
been called for <tt>timeout</tt> seconds.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001292-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001292-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 105</span>
105:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">verify!</span>(<span class="ruby-identifier">timeout</span>)
106:         <span class="ruby-identifier">now</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>
107:         <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@last_verification</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">timeout</span>
108:           <span class="ruby-identifier">reconnect!</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">active?</span>
109:           <span class="ruby-ivar">@last_verification</span> = <span class="ruby-identifier">now</span>
110:         <span class="ruby-keyword kw">end</span>
111:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M001296" class="method-detail">
        <a name="M001296"></a>

        <div class="method-heading">
          <a href="#M001296" class="method-signature">
          <span class="method-name">format_log_entry</span><span class="method-args">(message, dump = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001296-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001296-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 153</span>
153:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">format_log_entry</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">dump</span> = <span class="ruby-keyword kw">nil</span>)
154:           <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">colorize_logging</span>
155:             <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@row_even</span>
156:               <span class="ruby-ivar">@@row_even</span> = <span class="ruby-keyword kw">false</span>
157:               <span class="ruby-identifier">message_color</span>, <span class="ruby-identifier">dump_color</span> = <span class="ruby-value str">&quot;4;36;1&quot;</span>, <span class="ruby-value str">&quot;0;1&quot;</span>
158:             <span class="ruby-keyword kw">else</span>
159:               <span class="ruby-ivar">@@row_even</span> = <span class="ruby-keyword kw">true</span>
160:               <span class="ruby-identifier">message_color</span>, <span class="ruby-identifier">dump_color</span> = <span class="ruby-value str">&quot;4;35;1&quot;</span>, <span class="ruby-value str">&quot;0&quot;</span>
161:             <span class="ruby-keyword kw">end</span>
162: 
163:             <span class="ruby-identifier">log_entry</span> = <span class="ruby-node">&quot;  \e[#{message_color}m#{message}\e[0m   &quot;</span>
164:             <span class="ruby-identifier">log_entry</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\e[0m&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">dump</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dump</span>
165:             <span class="ruby-identifier">log_entry</span>
166:           <span class="ruby-keyword kw">else</span>
167:             <span class="ruby-value str">&quot;%s  %s&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">message</span>, <span class="ruby-identifier">dump</span>]
168:           <span class="ruby-keyword kw">end</span>
169:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001295" class="method-detail">
        <a name="M001295"></a>

        <div class="method-heading">
          <a href="#M001295" class="method-signature">
          <span class="method-name">log</span><span class="method-args">(sql, name) {|| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001295-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001295-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 128</span>
128:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-identifier">name</span>)
129:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
130:             <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@logger</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">debug?</span>
131:               <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">nil</span>
132:               <span class="ruby-identifier">seconds</span> = <span class="ruby-constant">Benchmark</span>.<span class="ruby-identifier">realtime</span> { <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">yield</span> }
133:               <span class="ruby-ivar">@runtime</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">seconds</span>
134:               <span class="ruby-identifier">log_info</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">seconds</span>)
135:               <span class="ruby-identifier">result</span>
136:             <span class="ruby-keyword kw">else</span>
137:               <span class="ruby-keyword kw">yield</span>
138:             <span class="ruby-keyword kw">end</span>
139:           <span class="ruby-keyword kw">else</span>
140:             <span class="ruby-identifier">log_info</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-identifier">name</span>, <span class="ruby-value">0</span>)
141:             <span class="ruby-keyword kw">nil</span>
142:           <span class="ruby-keyword kw">end</span>
143:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
144:           <span class="ruby-comment cmt"># Log message and raise exception.</span>
145:           <span class="ruby-comment cmt"># Set last_verification to 0, so that connection gets verified</span>
146:           <span class="ruby-comment cmt"># upon reentering the request loop</span>
147:           <span class="ruby-ivar">@last_verification</span> = <span class="ruby-value">0</span>
148:           <span class="ruby-identifier">message</span> = <span class="ruby-node">&quot;#{e.class.name}: #{e.message}: #{sql}&quot;</span>
149:           <span class="ruby-identifier">log_info</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">name</span>, <span class="ruby-value">0</span>)
150:           <span class="ruby-identifier">raise</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">StatementInvalid</span>, <span class="ruby-identifier">message</span>
151:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>